package directoryapp

import java.sql.Blob;

class Employee extends User {

	String firstName;
	String lastName;
	String nickname;
	EmployeePosition position;
	String hireDate;
	String location;
	String school;
	String birthDay;
	String hobbiesAndInterest;
	byte[] image;
	GenderCode gender;

	static hasMany = [contactDetails: String]

	static constraints = {
		firstName()
		lastName()
		nickname()
		position()
		location()
		contactDetails()
		image()
		hireDate(matches: "[0-1]?[0-9]/[0-3]?[0-9]/[0-9]{4}")
		birthDay(matches: "[0-1]?[0-9]/[0-3]?[0-9]/[0-9]{4}")
		school()
		gender()
	}
	static mapping = {
		image column: "image", sqlType: "longblob"
	}

	String toString() {
		lastName + ", " + firstName
	}
}
